package com.wn55.hrms.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Security;
import com.wn55.hrms.mapper.SecurityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author z
 */
@Service
public class SecurityService {
  @Autowired
    SecurityMapper securityMapper;

    public PageInfo<Security> securityList(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<Security> list = securityMapper.selectByName(name);
        System.out.println(list);
        return new PageInfo<>(list);

    }

    public void modify(Security security) {
        securityMapper.update(security);
    }

    public void add(Security security) {
        securityMapper.insert(security);
    }

    public void removeBykey(int id) {
        securityMapper.deleteByPrimaryKey(id);
    }


}
